package org.example.kidscode.entity;

import javax.persistence.*;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "class_card")
public class ClassCard {

    @Id
    @Column(name = "card_id", length = 20)
    private String cardId;

    @Column(name = "student_id", length = 20, nullable = false)
    private String studentId;

    @Column(name = "card_name", length = 50, nullable = false)
    private String cardName;

    @Column(name = "card_type", length = 20)
    private String cardType = "normal";

    @Column(name = "total_classes", nullable = false)
    private Short totalClasses;

    @Column(name = "remaining_classes", nullable = false)
    private Short remainingClasses;

    @Column(name = "price", precision = 10, scale = 2)
    private BigDecimal price;

    @Column(name = "start_date", nullable = false)
    private LocalDate startDate;

    @Column(name = "expire_date")
    private LocalDate expireDate;

    @Column(name = "is_notified")
    private Boolean isNotified = false;

    @CreationTimestamp
    @Column(name = "create_time", updatable = false)
    private LocalDateTime createTime;

    @UpdateTimestamp
    @Column(name = "update_time")
    private LocalDateTime updateTime;
}